const webpack = require("webpack");
const path = require("path");

module.exports = {
  mode: "production",
  entry: {
    //多个第三方库文件入口，也可以将所有第三方库文件打包成一个文件，但是这个文件会很大，不推荐这么做
    react: ["react", "react-dom", "react-router-dom"],
    //tip 在这里可以继续添加第三方库文件
  },
  output: {
    filename: "[name].dll.js",
    path: path.resolve(__dirname, "./dll"),
    library: "[name]_dll",
  },
  plugins: [
    //生成资源文件
    new webpack.DllPlugin({
      name: "[name]_dll",
      path: path.join(__dirname, "./dll", "[name].manifest.json"),
    }),
  ],
};
